﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Chapter06_Lesson01
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            Point point = new Point();
            Rectangle rectangle = new Rectangle();
            Size size = new Size();

            point.X = 50;
            point.Y = 50;

            size.Height = 50;
            size.Width = 200;

            TextBox textBox = new TextBox();
            textBox.Location = point;
            textBox.Size = size;

            this.Controls.Add(textBox);

            Graphics graphics = textBox.CreateGraphics();
            graphics.Clear(Color.FromArgb(244, 22, 134));
            graphics.RotateTransform(34);

        }

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = this.CreateGraphics();

            Pen p = new Pen(Color.Red, 7);

            Brush b = new SolidBrush(Color.Brown);

            g.FillPolygon(b, new Point[] {new Point(1,2), new Point(40,80), new Point(25, 40)});

            p.StartCap = System.Drawing.Drawing2D.LineCap.DiamondAnchor;
            p.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
            g.DrawLine(p, 50, 25, 400, 25);

            p.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDot;
            g.DrawLine(p, 50, 25, 400, 25);

            p.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot;
            g.DrawLine(p, 50, 50, 400, 50);

            p.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
            g.DrawLine(p, 50, 75, 400, 75);

            p.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
            g.DrawLine(p, 50, 100, 400, 100);

            g.Clear(Color.Blue);

        }

    }
}
